﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using YFrameWork.RunTime;

namespace YFrameWork.RunTime_Example
{
    public class TestUIGroup : MonoBehaviour
    {
        UIComponent UI;
        // Start is called before the first frame update
        void Start()
        {
            UI = GameEntry.Instance.GetComponent<UIComponent>();
            UI.AddUIForm(new UIConfigItem(UIFormType.test, "Panel", UIGroupType.Pop,typeof(DefaultUICanvas)));
            UI.AddUIForm(new UIConfigItem(UIFormType.TestUIForm, "Panel", UIGroupType.Pop, typeof(DefaultUICanvas)));
            UI.AddUIForm(new UIConfigItem(UIFormType.TestUIForm1, "Panel", UIGroupType.Pop, typeof(DefaultUICanvas)));
            UI.AddUIForm(new UIConfigItem(UIFormType.TestUIForm2, "Panel", UIGroupType.Pop, typeof(DefaultUICanvas)));

            UI.OpenUIForm(UIFormType.TestUIForm);

        }

        private void Update()
        {
            if (Input.GetKeyDown(KeyCode.A))
            {
                UI.OpenUIForm(UIFormType.TestUIForm1);
            }
            if (Input.GetKeyDown(KeyCode.S))
            {
                UI.OpenUIForm(UIFormType.TestUIForm2);
            }

            if (Input.GetKeyDown(KeyCode.Q))
            {
                UI.CloseUIForm(UIFormType.TestUIForm1);
            }
            if (Input.GetKeyDown(KeyCode.W))
            {
                UI.CloseUIForm(UIFormType.TestUIForm2);
            }

        }
    }
}